package com.adam.framework.db.page;


import javax.sql.RowSet;

public class RowSetPage extends Page {
    private javax.sql.RowSet rs;

   
    public static final RowSetPage EMPTY_PAGE = new RowSetPage();

   
    public RowSetPage(){
      this(null, 0,0);
    }

    
    public RowSetPage(RowSet crs, int start, int totalSize) {
        this(crs, start, totalSize, Page.DEFAULT_PAGE_SIZE);
    }

    /**
     *�����ҳ����
     *@param crs ��һҳ��ݵ�OracleCachedRowSet
     *@param start ��ҳ�������ݿ��е���ʼλ��
     *@param totalSize ��ݿ��а�ļ�¼����
     *@param pageSize ��ҳ�����ɵļ�¼��
     */
    public RowSetPage(RowSet crs, int start, int totalSize, int pageSize) {
        try{
            int avaCount=0;
            if (crs!=null) {
                crs.beforeFirst();
                if (crs.next()){
                    crs.last();
                    avaCount = crs.getRow();
                }
                crs.beforeFirst();
            }
            rs = crs;
            super.init(start,avaCount,totalSize,pageSize,rs);
        }catch(java.sql.SQLException sqle){
            throw new RuntimeException(sqle.toString());
        }
    }

    public javax.sql.RowSet getRowSet(){
        return rs;
    }

}

